package suncertify.db.test;

import suncertify.db.DBAccess;

public class AddUser extends Thread {

    private DBAccess data;
    private long[] records;
    private int newRecordsCount;

    /**
     * 
     * @param name
     *            sdfdf
     * @param data
     * @param noOfNewRecords
     */
    public AddUser(String name, DBAccess data, int noOfNewRecords) {

	super.setName(name);
	this.data = data;
	this.newRecordsCount = noOfNewRecords;
    }

    public void run() {

	String[] newRecord;

	for (int i = 1; i <= this.newRecordsCount; ++i) {

	    // Data.log("", "================= AddUser creating record " + Integer.toString(i) + " ==================");

	    try {

		newRecord = new String[6];

		newRecord[0] = this.getName() + Integer.toString(i);
		newRecord[1] = this.getName() + Integer.toString(i);
		newRecord[2] = this.getName() + Integer.toString(i);
		newRecord[3] = "100";
		newRecord[4] = "$40.00";
		newRecord[5] = "20300400";

		this.data.createRecord(newRecord);

	    } catch (Exception e) {
		e.printStackTrace();
	    }
	}
    }
}
